package util.AST.Expressao;

import util.AST.Terminal.OpRel;

public class ExpressaoRel  extends Expressao{
	
	private ExpressaoRelPrimaria expRelPriEsq;
	private OpRel opRelExpRel;
	private ExpressaoRelPrimaria expRelPriDir;
	
	private ExpressaoAri expAriEsq;
	private OpRel opRelExpAri;
	private ExpressaoAri expAriDir;
	
	public ExpressaoRel(ExpressaoRelPrimaria expRelPriEsq, OpRel opRelExpRel,ExpressaoRelPrimaria expRelPriDir, ExpressaoAri expAriEsq, OpRel opRelExpAri,ExpressaoAri expAriDir){
	
		this.expRelPriEsq = expRelPriEsq;
		this.opRelExpRel = opRelExpRel;
		this.expRelPriDir = expRelPriDir;
		
		this.expAriEsq = expAriEsq;
		this.opRelExpAri = opRelExpAri;
		this.expAriDir = expAriDir;
	}
	
	public ExpressaoRel(){
	}
	
	
	public ExpressaoRelPrimaria getExpRelPriEsq(){
		return this.expRelPriEsq;
	}
	
	public OpRel getOpRelExpRel(){
		return this.opRelExpRel;
	}

	public ExpressaoRelPrimaria getExpRelPriDir(){
		return this.expRelPriDir;
	}
	
	public ExpressaoAri getExpAriEsq(){
		return this.expAriEsq;
	}
	
	public OpRel getOpRelExpAri(){
		return this.opRelExpAri;
	}
	
	public ExpressaoAri getExpAriDir(){
		return this.expAriDir;
	}

	public String toString(int level) {
		int nextLevel = level+5;
		StringBuffer str = new StringBuffer();
		str.append("ExpRel\n");
		if ( this.expRelPriEsq != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.expRelPriEsq.toString(nextLevel));
		}
		if ( this.opRelExpRel != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.opRelExpRel.toString(nextLevel));
		}
		if ( this.expRelPriDir != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.expRelPriDir.toString(nextLevel));
		}
		
		if ( this.expAriEsq != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.expAriEsq.toString(nextLevel));
		}
		if ( this.opRelExpAri != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.opRelExpAri.toString(nextLevel));
		}
		if ( this.expAriDir != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.expAriDir.toString(nextLevel));
		}
		return str.toString();

	}
}
	
